<?php

namespace app\api\validate;

use think\Validate;

class Help extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'cat_id'  =>  'require|integer|gt:0',
        'help_name_id'  =>  'require|integer|gt:0',
        'score'  =>  'require|integer|gt:0|max:8',
        'content'  =>  'require',
        'grade'  =>  'require|number|gt:0',
    ];
    /**
     * 提示消息
     */
    protected $message = [
        'cat_id.require'  =>  '請選擇求助分類',
        'cat_id.integer'  =>   '求助分類類型錯誤',
        'cat_id.gt'  =>   '求助分類類型錯誤',
        'help_name_id.require'  =>  '請選擇求助標題',
        'help_name_id.integer'  =>   '求助標題類型錯誤',
        'help_name_id.gt'  =>   '求助標題類型錯誤',
        'score.require'  =>  '請輸入積分',
        'score.integer'  =>   '請輸入正確的積分',
        'score.gt'  =>   '請輸入正確的積分',
        'score.max'  =>  '積分不得超過8位數字',
        'content.require'  =>  '請輸入求助內容',
        'grade.require'  =>  '請選擇評分',
        'grade.number'  =>   '分數類型錯誤',
        'grade.gt'  =>   '分數類型錯誤',
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ['name','type','code'],
        'push' => ['cat_id','help_name_id','score','content'],
        'evaluation'  => ['id','grade'],
        'edit' => [],
    ];
    
}
